#include "databases.h"
#include <QDebug>

DataBases::DataBases(QObject *parent)
    : QObject{parent}
{

}

void DataBases::connectSql()
{

    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("localhost");
    db.setPort(3306);
    db.setDatabaseName("serveritem");
    db.setUserName("root");
    db.setPassword("123456");

    if (!db.open()){
        qDebug() << "数据库连接失败！";
    }

}



